import 'package:fish_redux/fish_redux.dart';
import 'action.dart';
import 'state.dart';
import '../../../app_files.dart';

Effect<EditInfoViewState> buildEffect() {
  return combineEffects(<Object, Effect<EditInfoViewState>>{
    EditInfoViewAction.action: _onAction,
    EditInfoViewAction.onEdit: _onEdit,
  });
}

void _onAction(Action action, Context<EditInfoViewState> ctx) {}

void _onEdit(Action action, Context<EditInfoViewState> ctx) async {
  if (ctx.state.editingController.text.length == 0) {
    CommonUtils.showToast(ctx.context, '请输入${ctx.state.title}',
        iconType: ToastTipsIconType.info);
    return;
  }
  Navigator.pop(ctx.context,ctx.state.editingController.text);
}
